package com.hrsystem.controller;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.hrsystem.entity.JobClassification;
import com.hrsystem.entity.OrgFirst;
import com.hrsystem.lang.Result;
import com.hrsystem.mapper.JobClassificationMapper;
import com.hrsystem.service.JobClassificationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;


@RestController

public class JobClassificationController {

    @Resource
    JobClassificationMapper jobClassificationMapper;

    @Autowired
    JobClassificationService jobClassificationService;

    @Transactional
    @GetMapping("/selectJobClassification")
    public Result selectJobClassificationList() {
        QueryWrapper<JobClassification> queryWrapper = new QueryWrapper<>();
        queryWrapper.select();
        List<JobClassification> jobClassificationList = jobClassificationMapper.selectList(queryWrapper);
        return Result.success(jobClassificationList);
    }

    @Transactional
    @PostMapping("/AddJobClassification")
    public Result addJobClassification(@RequestBody JobClassification jobClassification) {
        jobClassificationService.saveOrUpdate(jobClassification);
        return Result.success(null);
    }

}
